package com.foreveross.chameleon.user.plugin;


import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import com.foreveross.chameleon.shortcutbadger.ShortcutBadger;

/**
 * 
 * @author zhouzhineng
 *
 */
public class BadgerPlugin extends CordovaPlugin{

	public final static String ACTION_SETBADGER = "set_badger";
	@Override
	public boolean execute(String action, JSONArray args,
			CallbackContext callbackContext) throws JSONException {
		// TODO Auto-generated method stub
		if(action.equals(ACTION_SETBADGER)) {
			int badgerCount = (int)args.get(0);
			ShortcutBadger.with(cordova.getActivity().getApplicationContext()).count(badgerCount);
		}
		return super.execute(action, args, callbackContext);
	}

	
}
